#!/bin/bash
HASHES=$(git log "$1" | grep '^commit ' | sed 's/^commit //')

for i in $HASHES; do
  echo item: $i
  DIFF=$(git show "$i:$1" | diff -b - "$2")
  if [ "" = "$DIFF" ]; then
    echo "No difference: $i"
    git log "$i"
    break;
  fi
done